package com.shop.admin.validate.paper;

import com.shop.common.validator.annotation.IntegerContains;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 考卷库参数
 * @author DragonDean
 */
@Data
@ApiModel("考卷库更新参数")
public class PaperUpdateValidate implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(message = "id参数必传且需大于0")
    @ApiModelProperty(value = "ID")
    private Integer id;

    @NotNull(message = "code参数缺失")
    @ApiModelProperty(value = "编号")
    private String code;

    @NotNull(message = "title参数缺失")
    @ApiModelProperty(value = "名称")
    private String title;

    @ApiModelProperty(value = "是否公开")
    private Integer isPublic;

    @NotNull(message = "intro参数缺失")
    @ApiModelProperty(value = "介绍")
    private String intro;

    @NotNull(message = "passingMark参数缺失")
    @ApiModelProperty(value = "及格分数")
    private Integer passingMark;

    @NotNull(message = "time参数缺失")
    @ApiModelProperty(value = "考试时间(分钟)")
    private Integer time;

    @ApiModelProperty(value = "学分")
    private Integer credit;

    @NotNull(message = "状态参数缺失")
    @ApiModelProperty(value = "状态:0禁用，1启用")
    @IntegerContains(values = {0, 1}, message = "状态值不正确")
    private Integer status;

    @ApiModelProperty(value = "试题")
    private List<PaperQuestionValidate> questions;

    @ApiModelProperty(value = "前置课程")
    @Valid
    private List<PaperCourseValidate> courses;
}
